package com.mcxx.ansync.event;

import com.mcxx.modules.system.dto.PropertesChangeDTO;
import com.yinhai.ta404.core.security.vo.UserAccountVo;
import lombok.Getter;
import org.springframework.context.ApplicationEvent;


@Getter
public class PropertiesChangeEvent extends ApplicationEvent {
    private PropertesChangeDTO propertesChangeDTO;
    private UserAccountVo userAccountVo;

    public PropertiesChangeEvent(Object source, PropertesChangeDTO propertesChangeDTO, UserAccountVo userAccountVo) {
        super(source);
        this.userAccountVo = userAccountVo;
        this.propertesChangeDTO = propertesChangeDTO;
    }


    public PropertiesChangeEvent(Object source, Object afterObj, String category, UserAccountVo userAccountVo) {
        super(source);
        this.userAccountVo = userAccountVo;
        propertesChangeDTO = new PropertesChangeDTO();
        propertesChangeDTO.setCategory(category);
        propertesChangeDTO.setBeforeObj(null);
        propertesChangeDTO.setAfterObj(afterObj);
        propertesChangeDTO.setType(1);
        propertesChangeDTO.setClsName(null);
        propertesChangeDTO.setDesc(null);
    }


    public PropertiesChangeEvent(Object source, Object afterObj, int type, String category, UserAccountVo userAccountVo) {
        super(source);
        this.userAccountVo = userAccountVo;
        propertesChangeDTO = new PropertesChangeDTO();
        propertesChangeDTO.setCategory(category);
        propertesChangeDTO.setBeforeObj(null);
        propertesChangeDTO.setAfterObj(afterObj);
        propertesChangeDTO.setType(type);
        propertesChangeDTO.setClsName(null);
        propertesChangeDTO.setDesc(null);
    }


    public PropertiesChangeEvent(Object source, Object afterObj, int type, String category, String desc, UserAccountVo userAccountVo) {
        super(source);
        this.userAccountVo = userAccountVo;
        propertesChangeDTO = new PropertesChangeDTO();
        propertesChangeDTO.setCategory(category);
        propertesChangeDTO.setBeforeObj(null);
        propertesChangeDTO.setAfterObj(afterObj);
        propertesChangeDTO.setType(type);
        propertesChangeDTO.setClsName(null);
        propertesChangeDTO.setDesc(desc);
    }
}
